{include file="public/head"}

<body>
<div id="wrapper">
    {include file="public/menu"}

    <div id="page-wrapper" class="gray-bg dashbard-1">
        {include file="public/nav"}
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-10">
                <h2>商品信息</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:url('Index/index')}">主页</a>
                    </li>
                    <li>
                        <a>商品</a>
                    </li>
                    <li>
                        <strong>商品列表</strong>
                    </li>
                </ol>
            </div>
            <div class="col-lg-2">

            </div>
        </div>
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>商品信息列表</h5>
                            <div class="ibox-tools">
                                <small>共 {$Count} 条</small>
                            </div>
                        </div>

                        <div class="ibox-content">
                            <form method="get" action="{:url('User/UserList')}">
                                <div class="row">
                                    <div class="col-sm-3 m-b-xs">
                                        <div class="row">
                                            <div class="col-sm-2 m-b-xs"></div>
                                            <div class="col-sm-2 m-b-xs">商品分类</div>
                                            <div class="col-sm-5 m-b-xs">
                                                <select class="input-sm form-control input-s-sm inline" id="son_id" name="son_id">
                                                    <option value="0">全部</option>
                                                    {volist name="ClassList" id="vv"}
                                                    <option value="{$vv.id}" {if condition="$Data.son_id eq $vv.id"}selected{/if}>{$vv.name}</option>
                                                    {/volist}
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-sm-2 m-b-xs">
                                        <div class="row">
                                            <!--<div class="col-sm-2 m-b-xs"></div>-->
                                            <div class="col-sm-3 m-b-xs">商品名称</div>
                                            <div class="col-sm-7 m-b-xs">
                                                <input type="text" class="input-sm form-control input-s-sm inline" id="name" name="name" value="{$Data.name|default=''}">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-sm-2 m-b-xs">
                                        <div class="row">
                                            <!--<div class="col-sm-2 m-b-xs"></div>-->
                                            <div class="col-sm-3 m-b-xs">商品类型</div>
                                            <div class="col-sm-7 m-b-xs">
                                                <select class="input-sm form-control input-s-sm inline" id="goods_type" name="goods_type">
                                                    <option value="0" {if condition="$Data.goods_type eq 0"}selected{/if}>全部</option>
                                                    <option value="1" {if condition="$Data.goods_type eq 1"}selected{/if}>积分商品</option>
                                                    <option value="2" {if condition="$Data.goods_type eq 2"}selected{/if}>礼包商品</option>
                                                    <option value="3" {if condition="$Data.goods_type eq 3"}selected{/if}>复购商品</option>
                                                    <option value="4" {if condition="$Data.goods_type eq 4"}selected{/if}>秒杀商品</option>
                                                    <option value="5" {if condition="$Data.goods_type eq 5"}selected{/if}>拼团商品</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    <div class="col-sm-2 m-b-xs">
                                        <div class="row">
                                            <!--<div class="col-sm-2 m-b-xs"></div>-->
                                            <div class="col-sm-3 m-b-xs">是否上架</div>
                                            <div class="col-sm-5 m-b-xs">
                                                <select class="input-sm form-control input-s-sm inline" id="is_shelf" name="is_shelf">
                                                    <option value="0" {if condition="$Data.is_shelf eq 0"}selected{/if}>全部</option>
                                                    <option value="1" {if condition="$Data.is_shelf eq 1"}selected{/if}>下架</option>
                                                    <option value="2" {if condition="$Data.is_shelf eq 2"}selected{/if}>上架</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-sm-3 m-b-xs">
                                        <div class="row">
                                            <div class="col-sm-12 m-b-xs">
                                                <button class="btn btn-sm btn-primary" type="submit" id="search"><i class="fa fa-search"></i> 搜索</button>
<!--                                                <button class="btn btn-sm btn-success" type="submit" id="export">导出Excel</button>-->
                                                <a class="btn btn-sm btn-danger" href="javascript:;" onclick="user_add('新增商品','{:url("Goods/GoodsAdd")}','1000','570')">新增商品</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </form>
                            <div class="table-responsive" style="margin-top:20px">
                                <table class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>商品名称</th>
                                        <th>商品类型</th>
                                        <th>父级分类</th>
                                        <th>子级分类</th>
                                        <th>销售价</th>
                                        <!--<th>会员价</th>-->
                                        <!--<th>直推奖</th>-->
                                        <!--<th>一星级差</th>-->
                                        <!--<th>一星平一级</th>-->
                                        <!--<th>二星级差</th>-->
                                        <!--<th>二星平一级</th>-->
                                        <!--<th>三星级差</th>-->
                                        <!--<th>三星平一级</th>-->
                                        <!--<th>四星级差</th>-->
                                        <!--<th>四星平一级</th>-->
                                        <!--<th>县代级差</th>-->
                                        <!--<th>市代级差</th>-->
                                        <!--<th>省代级差</th>-->
                                        <th>商品Logo</th>
                                        <!--<th>是否推荐</th>-->
                                        <th>添加时间</th>
                                        <th>开始时间</th>
                                        <th>结束时间</th>
                                        <th>顺序</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="GoodsList" id="v"}
                                    <tr>
                                        <td>{$key+1}</td>
                                        <td>{$v.name}</td>
                                        <td>
                                            {if condition="$v.goods_type eq 1"}积分商品
                                            {elseif condition="$v.goods_type eq 2"/}礼包商品
                                            {elseif condition="$v.goods_type eq 3"/}复购商品
                                            {elseif condition="$v.goods_type eq 4"/}秒杀商品
                                            {elseif condition="$v.goods_type eq 5"/}拼团商品
                                            {/if}
                                        </td>
                                        <td>{$v.parent_class}</td>
                                        <td>{$v.son_class}</td>
                                        <td>{$v.price}元 / {$v.unit}</td>
                                        <!--<td>{$v.hyprice}元 / {$v.unit}</td>-->
                                        <!--<td>{$v.reward_1}元</td>-->
                                        <!--<td>{$v.oneji}元</td>-->
                                        <!--<td>{$v.onep}元</td>-->
                                        <!--<td>{$v.twoji}元</td>-->
                                        <!--<td>{$v.twop}元</td>-->
                                        <!--<td>{$v.threeji}元</td>-->
                                        <!--<td>{$v.threep}元</td>-->
                                        <!--<td>{$v.fourji}元</td>-->
                                        <!--<td>{$v.fourp}元</td>-->
                                        <!--<td>{$v.xian}元</td>-->
                                        <!--<td>{$v.shi}元</td>-->
                                        <!--<td>{$v.sheng}元</td>-->
                                        <td><img src="{$v.logo_url}" style="max-width: 50px"></td>
                                        <!--<td>-->
                                        <!--    {if condition="$v.is_recommend eq 1"}不推荐-->
                                        <!--    {elseif condition="$v.is_recommend eq 2"/}推荐-->
                                        <!--    {/if}-->
                                        <!--</td>-->
                                        <td>{$v.add_time|date="Y-m-d H:i",###}</td>
                                        <td>{if condition="$v.btime"}{$v.btime|date="Y-m-d H:i",###}{else/}不限{/if}</td>
                                        <td>{if condition="$v.etime"}{$v.etime|date="Y-m-d H:i",###}{else/}不限{/if}</td>
                                        <td>{$v.xu}</td>
                                        <td>
                                            {if condition="$v.is_shelf eq 1"}
                                            <a title="商品上架" class="btn btn-xs btn-success" href="javascript:;" onClick="goods_shelf(this,{$v.id})">上架</a>
                                            {elseif condition="$v.is_shelf eq 2"/}
                                            <a title="商品下架" class="btn btn-xs btn-warning" href="javascript:;" onClick="goods_shelf(this,{$v.id})">下架</a>
                                            {/if}
                                            <a title="信息编辑" class="btn btn-xs btn-primary" href="javascript:;" onclick="goods_edit('商品编辑','{:url("Goods/GoodsEdit",["id"=>$v["id"]])}','800','700')">编辑</a>
                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                            <div class="row" style="text-align: center">
                                {$Page}
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        {include file="public/foot"}

    </div>
</div>
</div>
{include file="public/footer"}
<script>
    /*会员-添加*/
    function user_add(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*会员-导入*/
    function user_import(title,url,w,h){
        layer_show(title,url,w,h);
    }

    /*条件搜索*/
    var searchurl = "{:url('Goods/GoodsList')}";
    $('#search').click(function () {

        $('form').attr('action',searchurl);
    });

    /*Excel导出*/
    var exporturl = "{:url('User/UserExport')}";
    $('#export').click(function () {

        $('form').attr('action',exporturl);
    });

    /*会员-编辑*/
    function goods_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }


    /*管理-删除*/
    function goods_shelf(obj,id){
        layer.confirm('确认要修改吗？',function(index){
            $.ajax({
                type:"post",
                url:"{:url('Goods/GoodsShelf')}",
                data:{
                    id:id,
                },
                dataType:"json",
                success:function(data){
                    if(data.status == 1){
                        layer.msg(data.message,{icon: 6,time:1500},function () {
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data.message,{icon: 5,time:1500});
                    }
                }
            });
        });
    }

    /*会员-登录*/
    function user_login(obj,id){
        $.ajax({
            type:"post",
            url:"{:url('User/UserLogin')}",
            data:{
                id:id,
            },
            dataType:"json",
            success:function(data){
                if(data.status == 1){
                    layer.msg(data.message,{icon: 6,time:1500},function () {
                        window.open("/index.php/index/index");
                    });
                }else{
                    layer.msg(data.message,{icon: 5,time:1500});
                }
            }
        });
    }

</script>
</body>
</html>
